package com.fullstuck.commit;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.beans.PropertyVetoException;


@Component("moneyimpl")
public class Moneyimpl implements Money{

    @Resource(name = "jdbcTemplate")
    JdbcTemplate jdbcTemplate;


//    事务控制注解 可以写在方法上也可以写在类上
    @Transactional
    public void updatemoney() throws PropertyVetoException {



        //执行操作
        jdbcTemplate.update("insert into employee values(?,?,?)","分店4",0,"0");
        int i = 1/0;
        jdbcTemplate.update("insert into employee values(?,?,?)","分店5",0,"0");
    }

}
